//
//  CommonColor.swift
//  TuJiaMerchant
//
//  Created by Charles on 14-9-9.
//  Copyright (c) 2014年 途家. All rights reserved.
//

import Foundation

public func UIColorMake(hexString: String, defaultColor: UIColor = UIColor.clear) -> UIColor {
    return UIColor(hexString: hexString) 
}


public class CommonColors {
    
    //boarder
    public static let kBorderColor = UIColor(red: 0.792157, green: 0.792157, blue: 0.792157, alpha: 1)
    
    public static let backGroundColor = UIColorMake(hexString: "#5264cc")// UIColorMake(hexString: "#536dfe")
    
    public static let defaultTitlecolor = UIColorMake(hexString: "#ffffff")
    
    public static let c_333333 = UIColorMake(hexString: "#333333")
    public static let c_999999 = UIColor(red: 0.6, green: 0.6, blue: 0.6, alpha: 1.0)
    public static let c_aaaaaa = UIColorMake(hexString: "#aaaaaa")
    public static let c_cccccc = UIColorMake(hexString: "#cccccc")
    public static let c_eeeeee = UIColorMake(hexString: "#eeeeee")
    public static let c_ffffff = UIColor.white
    public static let c_ffffff_90 = UIColor(red: 1, green: 1, blue: 1, alpha: 0.9)
    public static let c_536dfe = UIColorMake(hexString: "#5264cc") // changed
    public static let c_ff8a80 = UIColorMake(hexString: "#ff8a80")
    
    public static let c_f5f5f5 = UIColorMake(hexString: "#f5f5f5")
    
    public static let c_5264cc = UIColorMake(hexString: "#5264cc")
    public static let c_8c9eff = UIColorMake(hexString: "#8c9eff")
    public static let c_967adc = UIColorMake(hexString: "#967adc")
    public static let c_ffb74d = UIColorMake(hexString: "#ffb74d")
    public static let c_ffb000 = UIColorMake(hexString: "#ffb000")
    public static let c_81c784 = UIColorMake(hexString: "#81c784")
    
    public static let c_fafafa = UIColorMake(hexString: "#fafafa")
    public static let c_dcdcdc = UIColorMake(hexString: "#dcdcdc")
    public static let c_dadada = UIColorMake(hexString: "#dadada")
    
    public static let c_3f51b5 = UIColorMake(hexString: "#3f51b5")
    public static let c_526dfe = UIColorMake(hexString: "#5264cc")
    
    public static let c_c2c2c2 = UIColorMake(hexString: "#c2c2c2")
    
    public static let c_fb9087 = UIColorMake(hexString: "#fb9087")
    
    public static let c_fed47f = UIColorMake(hexString: "#fed47f")
    
    public static let c_e5e5e5 = UIColorMake(hexString: "#e5e5e5")
    
    public static let c_22242c_90 = UIColor(red: 0.133, green: 0.141, blue: 0.173, alpha: 0.9)
    public static let c_ffffff_94 = UIColor(red: 1, green: 1, blue: 1, alpha: 0.94)
    public static  let c_8c9eff_60 = UIColor(red: 0.549, green: 0.620, blue: 1, alpha: 0.6)
    
    public static let c_ff4f4d = UIColorMake(hexString: "#ff4f4d")
    public static let c_4d4d4d = UIColorMake(hexString: "#4d4d4d")
    // add by bc merge
    public static let c_fd8238 = UIColorMake(hexString: "#fd8238")
    public static let c_50e3c2 = UIColorMake(hexString: "#50e3c2")
    public static let c_666666 = UIColorMake(hexString: "#666666")
    public static let c_030303 = UIColorMake(hexString: "#030303")
    public static let c_f7f9fb = UIColorMake(hexString: "#f7f9fb")
    public static let c_e9e9e9 = UIColorMake(hexString: "#e9e9e9")
    public static let c_ff6666 = UIColorMake(hexString: "#ff6666")
    public static let c_fff3df = UIColorMake(hexString: "#fff3df")
    public static let c_0076ff = UIColorMake(hexString: "#0076ff")
    public static let c_44d39f = UIColorMake(hexString: "#44d39f")
    public static let c_b2b2b2 = UIColorMake(hexString: "#b2b2b2")
    public static let c_3ad49e = UIColorMake(hexString: "#3ad49e")
    public static let c_ebeef6 = UIColorMake(hexString: "#ebeef6")
    public static let c_d9d9d9 = UIColorMake(hexString: "#d9d9d9")
    public static let c_a9afbf = UIColorMake(hexString: "#a9afbf")
    public static let c_ededed = UIColorMake(hexString: "#ededed")
    public static let c_fbfbfb = UIColorMake(hexString: "#fbfbfb")
    
    public static let c_e8f2ff = UIColorMake(hexString: "#e8f2ff")
    public static let c_fdeed5 = UIColorMake(hexString: "#fdeed5")
    public static let c_000000 = UIColorMake(hexString: "#000000")
    public static let c_3f4956 = UIColorMake(hexString: "#3f4956")
    public static let c_f2f2f2 = UIColorMake(hexString: "#f2f2f2")
    public static let c_d3d3d3 = UIColorMake(hexString: "#d3d3d3")
    public static let c_c4c4c4 = UIColorMake(hexString: "#c4c4c4")
    public static let c_151515 = UIColorMake(hexString: "#151515")
    
    public static let c_2f2f2f = UIColor(hexString: "#2f2f2f")
    public static let c_959595 = UIColor(hexString: "#959595")
    public static let c_ed5c59 = UIColor(hexString: "#ed5c59")
    public static let c_e25f5f = UIColor(hexString: "#e25f5f")
    public static let c_f0f0f0 = UIColor(hexString: "#f0f0f0")
    public static let c_656565 = UIColor(hexString: "#656565")
}

extension UIColor {    
    public func toNewAlpha(_ newAlpha : CGFloat) -> UIColor {
        var red: CGFloat = 0
        var green: CGFloat = 0
        var blue: CGFloat = 0
        var alpha: CGFloat = 0
        self.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
        return UIColor(red: red, green: green, blue: blue, alpha: newAlpha)
    }
}

/// Visual Standard 视觉规范
public class VS: NSObject {
    // colors
    
    /// 按钮、标题选中 蓝色
    public static let mainBlue = CommonColors.c_5264cc
    
    /// 主红色
    public static let mainRed = CommonColors.c_ed5c59
    
    /// 辅助浅红色
    public static let assistRed = CommonColors.c_e25f5f
    
    /// 辅助浅蓝色
    public static let assistBlue = CommonColors.c_8c9eff
    
    /// 报表专用浅蓝
    public static let assistBlueLight = UIColorMake(hexString: "#ecedf6")
    
    /// 辅助浅紫色
    public static let assistPurple = CommonColors.c_967adc
    
    /// 辅助浅黄色
    public static let assistYellow = CommonColors.c_ffb74d
    
    /// 辅助浅绿色
    public static let assistGreen = CommonColors.c_81c784
    
    /// 浅灰背景 #f5f5f5
    public static let bgGray = CommonColors.c_f5f5f5
    
    /// 超浅灰背景 #fafafa
    public static let bgGrayLight = CommonColors.c_fafafa
    
    /// 页面分割线. #eeeeee
    public static let sepPageGray = CommonColors.c_f0f0f0
    
    /// 控件内部分割线. #c2c2c2
    public static let sepControlGray = CommonColors.c_dcdcdc
    
    /// 文字主标题，TAB标题文字. #333333
    public static let txtMain = CommonColors.c_2f2f2f
    
    /// 正文副标题. #666666
    public static let txtSubhead = CommonColors.c_656565
    public static let txtSubhead_0_5 = VS.txtSubhead.toNewAlpha(0.5)
    
    /// 次要内容. #999999
    public static let txtSecondary = CommonColors.c_959595
    
    /// 不重要提示性内容. #cccccc
    public static let txtUnimportant = CommonColors.c_cccccc
    
    /// 周年庆亮绿
    public static let anniversaryGreen = UIColorMake(hexString: "#3ae5d0")
    //背景橙色
    public static let bgOrange = CommonColors.c_fd8238
    
    // font
    public static let font25 = UIFont.systemFont(ofSize: 25)
    public static let font20 = UIFont.systemFont(ofSize: 20)
    public static let font18 = UIFont.systemFont(ofSize: 18)
    public static let font16 = UIFont.systemFont(ofSize: 16)
    public static let font15 = UIFont.systemFont(ofSize: 15)
    public static let font14 = UIFont.systemFont(ofSize: 14)
    public static let font12 = UIFont.systemFont(ofSize: 12)
    public static let font13 = UIFont.systemFont(ofSize: 13)
    public static let font11 = UIFont.systemFont(ofSize: 11)
    public static let font10 = UIFont.systemFont(ofSize: 10)
    public static let font8 = UIFont.systemFont(ofSize: 8)
    public static let font17 = UIFont.systemFont(ofSize: 17)
    
    // distance
    public static let corner2 : CGFloat = 2
    public static let corner3 : CGFloat = 3
    public static let corner4 : CGFloat = 4
    
    public static let margin25 : CGFloat = 25
    public static let margin20 : CGFloat = 20
    public static let margin15 : CGFloat = 15
    public static let margin11 : CGFloat = 11
    public static let margin10 : CGFloat = 10
    public static let margin8 : CGFloat = 8
    public static let margin5 : CGFloat = 5
    public static let margin12 : CGFloat = 12
    public static let margin30 : CGFloat = 30
}

